<?php
	$mec = new Match($_GET['id']);
	
	$mec->domacin->getRoster();
	$mec->gost->getRoster();
	
	$mec->domacin->stats = $mec->domacin->getMatchStats($mec->id);
	$mec->gost->stats = $mec->gost->getMatchStats($mec->id);
	
?>


        	<div class="fullPageBox">
            	<div class="scoreboard">
                	<div class="scoreboardTop">
                    	<div class="homeTeam"><a href="team/<?php echo $mec->domacin->id; ?>/<?php echo $mec->domacin->ime; ?>"><?php echo $mec->domacin->ime; ?></a></div>
                    	<div class="awayTeam"><a href="team/<?php echo $mec->gost->id; ?>/<?php echo $mec->gost->ime; ?>"><?php echo $mec->gost->ime; ?></a></div>
                    </div>
                    
                    <div class="scoreboardResult">
                    	<div class="homeLogo"><img src="media/teams/logo/<?php echo $mec->domacin->grb; ?>" height="100" /></div>
                        <div class="scoreboardScore"><?php echo $mec->domacin->stats->pts; ?> - <?php echo $mec->gost->stats->pts; ?></div>
                    	<div class="awayLogo"><img src="media/teams/logo/<?php echo $mec->gost->grb; ?>" height="100" /></div>
                    </div>
                    
                    <div class="scoreboardTeamStats">
                    	<div class="scoreboardStat statsOdd">
                        	<div class="scoreHome"><?php echo $mec->domacin->stats->ft; ?></div>
                            <div class="scoreName" style="background-position:<?php echo calculateBgWidth($mec->domacin->stats->ft, $mec->gost->stats->ft); ?>px 0">Free Throws</div>
                            <div class="scoreAway"><?php echo $mec->gost->stats->ft; ?></div>
                        </div>
                    	<div class="scoreboardStat">
                        	<div class="scoreHome"><?php echo $mec->domacin->stats->fg; ?></div>
                            <div class="scoreName" style="background-position:<?php echo calculateBgWidth($mec->domacin->stats->fg, $mec->gost->stats->fg); ?>px 0">Field Goals</div>
                            <div class="scoreAway"><?php echo $mec->gost->stats->fg; ?></div>
                        </div>
                    	<div class="scoreboardStat">
                        	<div class="scoreHome"><?php echo $mec->domacin->stats->threept; ?></div>
                            <div class="scoreName" style="background-position:<?php echo calculateBgWidth($mec->domacin->stats->threept, $mec->gost->stats->threept); ?>px 0">3-Pointers</div>
                            <div class="scoreAway"><?php echo $mec->gost->stats->threept; ?></div>
                        </div>
                    	<div class="scoreboardStat">
                        	<div class="scoreHome"><?php echo $mec->domacin->stats->drbd; ?></div>
                            <div class="scoreName" style="background-position:<?php echo calculateBgWidth($mec->domacin->stats->drbd, $mec->gost->stats->drbd); ?>px 0">Defensive Rebounds</div>
                            <div class="scoreAway"><?php echo $mec->gost->stats->drbd; ?></div>
                        </div>
                    	<div class="scoreboardStat">
                        	<div class="scoreHome"><?php echo $mec->domacin->stats->orbd; ?></div>
                            <div class="scoreName" style="background-position:<?php echo calculateBgWidth($mec->domacin->stats->orbd, $mec->gost->stats->orbd); ?>px 0">Offensive Rebounds</div>
                            <div class="scoreAway"><?php echo $mec->gost->stats->orbd; ?></div>
                        </div>
                    	<div class="scoreboardStat">
                        	<div class="scoreHome"><?php echo $mec->domacin->stats->totalRbd; ?></div>
                            <div class="scoreName" style="background-position:<?php echo calculateBgWidth($mec->domacin->stats->totalRbd, $mec->gost->stats->totalRbd); ?>px 0">Total Rebounds</div>
                            <div class="scoreAway"><?php echo $mec->gost->stats->totalRbd; ?></div>
                        </div>
                    	<div class="scoreboardStat">
                        	<div class="scoreHome"><?php echo $mec->domacin->stats->blk; ?></div>
                            <div class="scoreName" style="background-position:<?php echo calculateBgWidth($mec->domacin->stats->blk, $mec->gost->stats->blk); ?>px 0">Blocks</div>
                            <div class="scoreAway"><?php echo $mec->gost->stats->blk; ?></div>
                        </div>
                    	<div class="scoreboardStat">
                        	<div class="scoreHome"><?php echo $mec->domacin->stats->ast; ?></div>
                            <div class="scoreName" style="background-position:<?php echo calculateBgWidth($mec->domacin->stats->ast, $mec->gost->stats->ast); ?>px 0">Assists</div>
                            <div class="scoreAway"><?php echo $mec->gost->stats->ast; ?></div>
                        </div>
                    	<div class="scoreboardStat">
                        	<div class="scoreHome"><?php echo $mec->domacin->stats->stl; ?></div>
                            <div class="scoreName" style="background-position:<?php echo calculateBgWidth($mec->domacin->stats->stl, $mec->gost->stats->stl); ?>px 0">Steals</div>
                            <div class="scoreAway"><?php echo $mec->gost->stats->stl; ?></div>
                        </div>
                    	<div class="scoreboardStat">
                        	<div class="scoreHome"><?php echo $mec->domacin->stats->licne; ?></div>
                            <div class="scoreName" style="background-position:<?php echo calculateBgWidth($mec->domacin->stats->licne, $mec->gost->stats->licne); ?>px 0">Fouls</div>
                            <div class="scoreAway"><?php echo $mec->gost->stats->licne; ?></div>
                        </div>
                    </div>
                </div>
            </div><!-- end of scoreboard -->
                        
            <div class="twoCollumns">
            	<div class="leftCollumn">
                
                	<div class="leftBox">
                    	<table class="tabela teamStatistics" cellpadding="0" cellspacing="0">
                        <thead>
                            <tr>
                            	<td>#</td>
                            	<td></td>
                            	<td class="statsPlayerName">Player</td>
                            	<td>PTS</td>
                            	<td>FT</td>
                            	<td>2PT</td>
                            	<td>3PT</td>
                            	<td>ASS</td>
                            	<td>DRB</td>
                            	<td>ORB</td>
                            	<td>BLK</td>
                            	<td>STL</td>
                            	<td>FLS</td>
                            	<td>IND</td>
                            </tr>
                        </thead>
                        <tbody>
                        	<?php
								foreach ($mec->domacin->roster as $igrac) {
									$igrac->getStats($mec->id);
							?>
                        	<tr>
                            	<td class="statsOdd"><?php echo $igrac->dres; ?></td>
                            	<td class="statsOdd"><img src="media/players/<?php echo $igrac->slika; ?>" width="30" /></td>
                            	<td class="statsPlayerName"><a href="player/<?php echo $igrac->id; ?>/<?php echo $igrac->ime; ?>-<?php echo $igrac->prezime; ?>"><?php echo $igrac->ime; ?> <?php echo $igrac->prezime; ?></a></td>
                            	<td class="statsOdd"><?php echo $igrac->stats[$mec->id]->pts; ?></td>
                            	<td><?php echo $igrac->stats[$mec->id]->ft; ?>/<?php echo $igrac->stats[$mec->id]->ft + $igrac->stats[$mec->id]->mft; ?></td>
                            	<td class="statsOdd"><?php echo $igrac->stats[$mec->id]->fg; ?>/<?php echo $igrac->stats[$mec->id]->fg + $igrac->stats[$mec->id]->mfg; ?></td>
                            	<td><?php echo $igrac->stats[$mec->id]->threept; ?>/<?php echo $igrac->stats[$mec->id]->threept + $igrac->stats[$mec->id]->mtp; ?></td>
                            	<td class="statsOdd"><?php echo $igrac->stats[$mec->id]->ast; ?></td>
                            	<td><?php echo $igrac->stats[$mec->id]->drbd; ?></td>
                            	<td class="statsOdd"><?php echo $igrac->stats[$mec->id]->orbd; ?></td>
                            	<td><?php echo $igrac->stats[$mec->id]->blk; ?></td>
                            	<td class="statsOdd"><?php echo $igrac->stats[$mec->id]->stl; ?></td>
                            	<td><?php echo $igrac->stats[$mec->id]->licne; ?></td>
                            	<td class="statsOdd"><strong><?php echo $igrac->stats[$mec->id]->BLindex; ?></strong></td>
                            </tr>
                        	<?php
								}
							?>
                        </tbody>
                        </table>
                    </div>
                    <h3 class="smallBoxTitle"><a href="#">Home Statistics</a></h3>
                    
                	<div class="leftBox">
                    	<table class="tabela teamStatistics" cellpadding="0" cellspacing="0">
                        <thead>
                            <tr>
                            	<td>#</td>
                            	<td></td>
                            	<td class="statsPlayerName">Player</td>
                            	<td>PTS</td>
                            	<td>FT</td>
                            	<td>2PT</td>
                            	<td>3PT</td>
                            	<td>ASS</td>
                            	<td>DRB</td>
                            	<td>ORB</td>
                            	<td>BLK</td>
                            	<td>STL</td>
                            	<td>FLS</td>
                            	<td>IND</td>
                            </tr>
                        </thead>
                        <tbody>
                        	<?php
								foreach ($mec->gost->roster as $igrac) {
									$igrac->getStats($mec->id);
							?>
                        	<tr>
                            	<td class="statsOdd"><?php echo $igrac->dres; ?></td>
                            	<td class="statsOdd"><img src="media/players/<?php echo $igrac->slika; ?>" width="30" /></td>
                            	<td class="statsPlayerName"><a href="player/<?php echo $igrac->id; ?>/<?php echo $igrac->ime; ?>-<?php echo $igrac->prezime; ?>"><?php echo $igrac->ime; ?> <?php echo $igrac->prezime; ?></a></td>
                            	<td class="statsOdd"><?php echo $igrac->stats[$mec->id]->pts; ?></td>
                            	<td><?php echo $igrac->stats[$mec->id]->ft; ?>/<?php echo $igrac->stats[$mec->id]->ft + $igrac->stats[$mec->id]->mft; ?></td>
                            	<td class="statsOdd"><?php echo $igrac->stats[$mec->id]->fg; ?>/<?php echo $igrac->stats[$mec->id]->fg + $igrac->stats[$mec->id]->mfg; ?></td>
                            	<td><?php echo $igrac->stats[$mec->id]->threept; ?>/<?php echo $igrac->stats[$mec->id]->threept + $igrac->stats[$mec->id]->mtp; ?></td>
                            	<td class="statsOdd"><?php echo $igrac->stats[$mec->id]->ast; ?></td>
                            	<td><?php echo $igrac->stats[$mec->id]->drbd; ?></td>
                            	<td class="statsOdd"><?php echo $igrac->stats[$mec->id]->orbd; ?></td>
                            	<td><?php echo $igrac->stats[$mec->id]->blk; ?></td>
                            	<td class="statsOdd"><?php echo $igrac->stats[$mec->id]->stl; ?></td>
                            	<td><?php echo $igrac->stats[$mec->id]->licne; ?></td>
                            	<td class="statsOdd"><strong><?php echo $igrac->stats[$mec->id]->BLindex; ?></strong></td>
                            </tr>
                        	<?php
								}
							?>
                        </tbody>
                        </table>
                    </div>
                    <h3 class="smallBoxTitle"><a href="#">Away Statistics</a></h3>
					
                    <?php
						if (count($mec->highlights)) {
					?>
                    <?php foreach($mec->highlights as $video) { ?>
                	<div class="leftBox">
                    	<?php $video->show(); ?>
                    </div>
                    <h3 class="smallBoxTitle"><a href="#">Highlights</a></h3>
                    <?php }} ?>
                    
                                        
                </div>
                
                <div class="rightCollumn">
                    
                	<div class="smallBox">
                    	<div class="mvpKola">
                        	<?php
								$mvp = $mec->findMVP();
								if ($mvp) {
							?>
                        	<a href="#"><img class="mvpPlayerImage" src="media/players/<?php echo $mvp->slika; ?>" /></a>
                            <div class="mvpPlayerInfo">
                            	<a href="player/<?php echo $mvp->id; ?>/<?php echo $mvp->ime; ?>-<?php echo $mvp->prezime; ?>" class="mvpPlayerName"><?php echo $mvp->ime; ?></a>
                                <a href="player/<?php echo $mvp->id; ?>/<?php echo $mvp->ime; ?>-<?php echo $mvp->prezime; ?>" class="mvpPlayerLastName"><?php echo $mvp->prezime; ?></a>
                                <a href="team/<?php echo $mvp->getTeamInfo()->id; ?>/<?php echo $mvp->getTeamInfo()->ime; ?>" class="mvpPlayerTeam"><?php echo $mvp->getTeamInfo()->ime; ?></a>
                            </div>
                            <div class="mvpPlayerStats">
                            	<div class="mvpPlayerStatLeft mvpstat1"><span><?php echo $mvp->stats[$mec->id]->pts; ?></span> points</div>
                            	<div class="mvpPlayerStatRight mvpstat2"><span><?php echo $mvp->stats[$mec->id]->totalRbd; ?></span> rebounds</div>
                            	<div class="mvpPlayerStatLeft mvpstat2"><span><?php echo $mvp->stats[$mec->id]->ast; ?></span> assists</div>
                            	<div class="mvpPlayerStatRight mvpstat3"><span><?php echo $mvp->stats[$mec->id]->blk; ?></span> blocks</div>
                            </div>
                            <?php
								}
							?>
                        </div>
                    </div>
                    <h3 class="smallBoxTitle"><a href="#">Game MVP</a></h3>
                </div>
                    
